﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Synergy
{
    public partial class Form工序列表 : Form
    {
      public  List<string> 选择工序 = new List<string>();

        public Form工序列表()
        {
            InitializeComponent();
        }

        private void Form工序列表_Load(object sender, EventArgs e)
        {
            string sql = "select Description from sfc_operation ";
            DataTable dt = SqlSugarHelp.scope.Ado.GetDataTable(sql);
            dataGridView1.DataSource = dt;

            
        }

        private void button确定_Click(object sender, EventArgs e)
        {
            选择工序.Clear();
                //获取dataGridView1被选择的所有工序
            if (dataGridView1.Rows.Count > 0)
            {
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    DataGridViewCheckBoxCell checkBoxCell = row.Cells["选择"] as DataGridViewCheckBoxCell;
                    bool isChecked = Convert.ToBoolean(checkBoxCell.Value);
                    if (isChecked)
                    {
                        // 处理复选框选中的行
  
                        选择工序.Add(row.Cells["工序"].Value.ToString());
                    }
                }
            }

            if (选择工序.Count > 0)
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("请选择工序");
            }
        }
    }
}
